package com.tanhua.dubbo.api;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tan.model.domain.Question;
import com.tanhua.dubbo.mapper.QuestionMapper;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;


@DubboService
public class QuestionApiImpl implements QuestionApi{
    @Autowired
    private QuestionMapper QuestionMapper;


    @Override
    public Question findByUserId(Long userId) {
        QueryWrapper<Question> qw = new QueryWrapper<>();
        qw.eq("user_id",userId);
        return QuestionMapper.selectOne(qw);


    }

    @Override
    public void updatetxt(Question question) {
        QuestionMapper.updateById(question);
    }

    @Override
    public void save(Question question) {
        QuestionMapper.insert(question);

    }

}
